<!DOCTYPE html>
<html>

<head>
  <title>Android下载</title>
  <meta http-equiv="Content-Type" content="text/html" ; charset="utf8">
  <meta http-equiv="Access-Control-Allow-Origin" content="*" />
  <style type="text/css">
    * {
      margin: 0;
      padding: 0;
      text-align: center;
    }

    body {
      TEXT-ALIGN: center;
      width: 100%;
      height: 100%;
    }

    .icon {
      margin-left: auto;
      margin-right: auto;
      margin-top: 10%;
      margin-bottom: 2%;
    }

    .btn {
      margin-left: auto;
      margin-right: auto;
      background: url(./btn.png) no-repeat center center;
      margin-top: 4%;
      width: 364px;
      height: 84px;
      cursor: pointer;
    }

    .btn:hover {
      background: url(./btn-hover.png) no-repeat center center;
    }

    label {
      font-size: 25px;
      color: #666666;
    }

    img[src=""],
    img:not([src]) {
      opacity: 0;
    }

    .model {
      position: fixed;
      left: 0;
      top: 0;
      background: rgba(0, 0, 0, 0.8);
      width: 100%;
      height: 100%;
      z-index: 100;
      display: none;
    }

    .model img {
      max-width: 100%;
      height: auto;
      zoom: 1.5;
    }

    .model p {
      text-align: center;
      margin-top: 10%;
      padding: 0 5%;
    }

  </style>
</head>

<body onload="onload()">
  <div class="model">
    <p><img src="./w.png" /></p>
  </div>
  <img class="icon" id="android-icon" src="" />
  <br />
  <label id="softV"></label>
  <div id="btn" class="btn" onclick="download()"></div>
  <label
    style="color:red;margin-top:4%; margin-left: auto;margin-right: auto;display:block;">友情提示：请通过浏览器打开该网页进行下载！</label>
</body>

<script type="text/javascript" src="jQuery-2.2.0.min.js"></script>
<script type="text/javascript">
  var url = "";
  $(function () {
    var platformCode = "yxyljg";
    var remoteServerPath = 'http://file.yx-ilink.com/';
    if (getUrlParam("platformCode")) {
      platformCode = getUrlParam("platformCode");
    }
    var icon = remoteServerPath + platformCode + "/pc/login/download/plat.png";
    var organizationId = getUrlParam("organizationId");
    var softName = getUrlParam("softName");
    url = getUrlParam("url");
    console.log(url)
    $("#softV").html(softName + "版本");
    $("#android-icon").attr("src", icon);
  });

  function download() {
    if (is_weixin()) {
      window.location = url;
    } else {
      window.location.href = url;

    }
  }

  function onload() {
    if (is_weixin()) {
      window.location = url;
      $(".model").show();
    }

  }

  function getUrlParam(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
    var r = window.location.search.substr(1).match(reg); //匹配目标参数
    if (r != null && unescape(r[2]) != "undefined") return unescape(r[2]);
    return null; //返回参数值 //中文需要 escape("最后二次上传") 先这样加密
  }

  function is_weixin() {
    var ua = navigator.userAgent.toLowerCase();
    if (ua.match(/MicroMessenger/i) == "micromessenger") {
      return true;
    } else {
      return false;
    }
  }

</script>

</html>
